Skip to content

x402 Payload now returns the root delegator, instead of the leaf delegator#251

Merged
jeffsmale90 merged 2 commits into
mainfrom
fix/x402-delegator
May 27, 2026
Merged

x402 Payload now returns the root delegator, instead of the leaf delegator#251
jeffsmale90 merged 2 commits into
mainfrom
fix/x402-delegator

Conversation

@jeffsmale90
Copy link
Copy Markdown
Collaborator

@jeffsmale90 jeffsmale90 commented May 27, 2026

📝 Description

The x402DelegationProvider was incorrectly returning the leaf delegator, instead of the root delegator.

This PR fixes that.

🔄 What Changed?

List the specific changes made:

🚀 Why?

Explain the motivation behind these changes:

🧪 How to Test?

Describe how to test these changes:

  • Manual testing steps:
  • Automated tests added/updated
  • All existing tests pass

⚠️ Breaking Changes

List any breaking changes:

  • No breaking changes
  • Breaking changes (describe below):

📋 Checklist

Check off completed items:

  • Code follows the project's coding standards
  • Self-review completed
  • Documentation updated (if needed)
  • Tests added/updated
  • Changelog updated (if needed)
  • All CI checks pass

🔗 Related Issues

Link to related issues:
Closes #
Related to #

📚 Additional Notes

Any additional information, concerns, or context:


Note

Medium Risk
Changes the meaning of delegator on an experimental payment API; correct for delegation chains but may break consumers that assumed the leaf delegator.

Overview
The experimental createx402DelegationProvider payment payload now exposes the root delegator for the delegation chain instead of the leaf delegator from the newly signed open delegation.

resolveDelegationCreationContext computes rootDelegator as the delegator on the last entry in existingDelegations (from parentPermissionContext), or from when there is no parent chain, and the provider returns that address in delegator. Tests and the changelog entry for the experimental provider are updated accordingly.

Integrators that relied on the previous (incorrect) leaf delegator value will see a behavior change when redeeming or displaying x402 payloads with a parent permission context.

Reviewed by Cursor Bugbot for commit 3607751. Bugbot is set up for automated code reviews on this repo. Configure here.

@jeffsmale90 jeffsmale90 requested a review from a team as a code owner May 27, 2026 07:27
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 37e110f. Configure here.

Comment thread packages/smart-accounts-kit/src/experimental/x402DelegationProviderUtils.ts Outdated
@jeffsmale90 jeffsmale90 force-pushed the fix/x402-delegator branch from a823df6 to 3607751 Compare May 27, 2026 19:03
Copy link
Copy Markdown
Contributor

@mj-kiwi mj-kiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeffsmale90 jeffsmale90 merged commit 647237c into main May 27, 2026
18 checks passed
@jeffsmale90 jeffsmale90 deleted the fix/x402-delegator branch May 27, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants